package com.hu.video.controller;

import com.hu.video.entity.VideoWhitelist;
import com.hu.video.service.IVideoWhitelistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/video/whitelist")
public class VideoWhitelistController {
    @Autowired
    private IVideoWhitelistService service;

    @GetMapping("/{videoId}")
    public List<VideoWhitelist> getWhitelist(@PathVariable Long videoId) {
        return service.getByVideoId(videoId);
    }

    @PostMapping("/add")
    public String addWhitelist(@RequestBody VideoWhitelist whitelist) {
        service.addWhitelist(whitelist);
        return "success";
    }

    @PostMapping("/remove")
    public String removeWhitelist(@RequestBody VideoWhitelist whitelist) {
        service.removeWhitelist(whitelist);
        return "success";
    }
} 